const {Sequelize} = require('sequelize')

const {database,username,password,host} = require('@/config/default').db
const db = new Sequelize(database,username,password,{
    host,
    dialect:'mysql',
    logging:false,
    define:{
        freezeTableName:true, // 禁止自动给表名加复数s
        timestamps:false
    },
    sync:{
        force:false   //不会强制删除现有表并且重新创建
    }
})

db.sync();  //如果表不存在就自动创建，存在则不会执行任何操作

module.exports = db